     /* emulated ioctl list */

     IOCTL(TCGETS2, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios2)))
     IOCTL(TCSETS2, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios2)))
     IOCTL(TCGETS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios)))
     IOCTL(TCSETS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
     IOCTL(TCSETSF, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
     IOCTL(TCSETSW, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
     IOCTL(TIOCGWINSZ, IOC_R, MK_PTR(MK_STRUCT(STRUCT_winsize)))
     IOCTL(TIOCSWINSZ, IOC_W, MK_PTR(MK_STRUCT(STRUCT_winsize)))
     IOCTL(FIONREAD, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(TCGETA, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(TCSETA, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TCSETAW, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TCSETAF, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TCSBRK, 0, TYPE_INT)
     IOCTL(TCSBRKP, 0, TYPE_INT)
     IOCTL(TCXONC, 0, TYPE_INT)
     IOCTL(TCFLSH, 0, TYPE_INT)
     IOCTL(TIOCEXCL, 0, TYPE_NULL)
     IOCTL(TIOCNXCL, 0, TYPE_NULL)
     IOCTL(TIOCSCTTY, 0, TYPE_INT)
     IOCTL(TIOCGPGRP, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(TIOCSPGRP, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCGSID, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCOUTQ, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(TIOCSTI, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCMGET, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(TIOCMBIS, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCMBIC, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCMSET, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCGSOFTCAR, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(TIOCSSOFTCAR, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCLINUX, IOC_R | IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCCONS, 0, TYPE_NULL)
     IOCTL(TIOCGSERIAL, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(TIOCSSERIAL, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCPKT, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(FIONBIO, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCNOTTY, 0, TYPE_NULL)
     IOCTL(TIOCGETD, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(TIOCSETD, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCGPTN, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(TIOCSPTLCK, IOC_W, MK_PTR(TYPE_INT))
#ifdef TIOCGPTPEER
     IOCTL_SPECIAL(TIOCGPTPEER, 0, do_ioctl_tiocgptpeer, TYPE_INT)
#endif
     IOCTL(FIOCLEX, 0, TYPE_NULL)
     IOCTL(FIONCLEX, 0, TYPE_NULL)
     IOCTL(FIOASYNC, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(TIOCGLCKTRMIOS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios)))
     IOCTL(TIOCSLCKTRMIOS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
     IOCTL(TIOCSERCONFIG, 0, TYPE_NULL)
     IOCTL(TIOCSERGETLSR, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(TIOCSERGETMULTI, IOC_R, MK_PTR(MK_STRUCT(STRUCT_serial_multiport_struct)))
     IOCTL(TIOCSERSETMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_serial_multiport_struct)))
     IOCTL(TIOCMIWAIT, 0, TYPE_INT)
     IOCTL(TIOCGICOUNT, IOC_R, MK_PTR(MK_STRUCT(STRUCT_serial_icounter_struct)))

     IOCTL(KIOCSOUND, 0, TYPE_INT)
     IOCTL(KDMKTONE, 0, TYPE_INT)
     IOCTL(KDSETMODE, 0, TYPE_INT)
     IOCTL(KDGKBTYPE, IOC_R, MK_PTR(TYPE_CHAR))
     IOCTL(KDGKBMODE, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(KDSKBMODE, 0, TYPE_INT)
     IOCTL(KDGKBENT, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_kbentry)))
     IOCTL(KDGKBSENT, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_kbsentry)))
     IOCTL(KDGKBLED, 0, TYPE_INT)
     IOCTL(KDSKBLED, 0, TYPE_INT)
     IOCTL(KDGETLED, 0, TYPE_INT)
     IOCTL(KDSETLED, 0, TYPE_INT)
     IOCTL_SPECIAL(KDSIGACCEPT, 0, do_ioctl_kdsigaccept, TYPE_INT)

     IOCTL(RTC_AIE_ON, 0, TYPE_NULL)
     IOCTL(RTC_AIE_OFF, 0, TYPE_NULL)
     IOCTL(RTC_UIE_ON, 0, TYPE_NULL)
     IOCTL(RTC_UIE_OFF, 0, TYPE_NULL)
     IOCTL(RTC_PIE_ON, 0, TYPE_NULL)
     IOCTL(RTC_PIE_OFF, 0, TYPE_NULL)
     IOCTL(RTC_WIE_ON, 0, TYPE_NULL)
     IOCTL(RTC_WIE_OFF, 0, TYPE_NULL)
     IOCTL(RTC_ALM_READ, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_time)))
     IOCTL(RTC_ALM_SET, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_time)))
     IOCTL(RTC_RD_TIME, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_time)))
     IOCTL(RTC_SET_TIME, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_time)))
     IOCTL(RTC_IRQP_READ, IOC_R, MK_PTR(TYPE_ULONG))
     IOCTL(RTC_IRQP_SET, IOC_W, TYPE_ULONG)
     IOCTL(RTC_EPOCH_READ, IOC_R, MK_PTR(TYPE_ULONG))
     IOCTL(RTC_EPOCH_SET, IOC_W, TYPE_ULONG)
     IOCTL(RTC_WKALM_RD, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_wkalrm)))
     IOCTL(RTC_WKALM_SET, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_wkalrm)))
     IOCTL(RTC_PLL_GET, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_pll_info)))
     IOCTL(RTC_PLL_SET, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_pll_info)))
     IOCTL(RTC_VL_READ, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(RTC_VL_CLR, 0, TYPE_NULL)

     IOCTL(BLKROSET, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(BLKROGET, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(BLKRRPART, 0, TYPE_NULL)
     IOCTL(BLKGETSIZE, IOC_R, MK_PTR(TYPE_ULONG))
#ifdef BLKGETSIZE64
     IOCTL(BLKGETSIZE64, IOC_R, MK_PTR(TYPE_ULONGLONG))
#endif
     IOCTL(BLKFLSBUF, 0, TYPE_NULL)
     IOCTL(BLKRASET, 0, TYPE_INT)
     IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG))
     IOCTL(BLKSSZGET, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(BLKBSZGET, IOC_R, MK_PTR(TYPE_INT))
     IOCTL_SPECIAL(BLKPG, IOC_W, do_ioctl_blkpg,
                   MK_PTR(MK_STRUCT(STRUCT_blkpg_ioctl_arg)))

#ifdef BLKDISCARD
     IOCTL(BLKDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
#endif
#ifdef BLKIOMIN
     IOCTL(BLKIOMIN, IOC_R, MK_PTR(TYPE_INT))
#endif
#ifdef BLKIOOPT
     IOCTL(BLKIOOPT, IOC_R, MK_PTR(TYPE_INT))
#endif
#ifdef BLKALIGNOFF
     IOCTL(BLKALIGNOFF, IOC_R, MK_PTR(TYPE_INT))
#endif
#ifdef BLKPBSZGET
     IOCTL(BLKPBSZGET, IOC_R, MK_PTR(TYPE_INT))
#endif
#ifdef BLKDISCARDZEROES
     IOCTL(BLKDISCARDZEROES, IOC_R, MK_PTR(TYPE_INT))
#endif
#ifdef BLKSECDISCARD
     IOCTL(BLKSECDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
#endif
#ifdef BLKROTATIONAL
     IOCTL(BLKROTATIONAL, IOC_R, MK_PTR(TYPE_SHORT))
#endif
#ifdef BLKZEROOUT
     IOCTL(BLKZEROOUT, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
#endif

     IOCTL(FDMSGON, 0, TYPE_NULL)
     IOCTL(FDMSGOFF, 0, TYPE_NULL)
     IOCTL(FDSETEMSGTRESH, 0, TYPE_NULL)
     IOCTL(FDFMTBEG, 0, TYPE_NULL)
     IOCTL(FDFMTTRK, IOC_W, MK_PTR(MK_STRUCT(STRUCT_format_descr)))
     IOCTL(FDFMTEND, 0, TYPE_NULL)
     IOCTL(FDFLUSH, 0, TYPE_NULL)
     IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
     IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
     IOCTL(FDRESET, 0, TYPE_NULL)
     IOCTL(FDRAWCMD, 0, TYPE_NULL)
     IOCTL(FDTWADDLE, 0, TYPE_NULL)
     IOCTL(FDEJECT, 0, TYPE_NULL)

#ifdef FIBMAP
     IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
#endif
#ifdef FICLONE
     IOCTL(FICLONE, IOC_W, TYPE_INT)
     IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
#endif
     IOCTL_SPECIAL(FIDEDUPERANGE, IOC_W | IOC_R, do_ioctl_fideduperange ,MK_PTR(MK_STRUCT(STRUCT_file_dedupe_range)))

#ifdef FIGETBSZ
     IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
#endif
#ifdef CONFIG_FIEMAP
     IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
                   MK_PTR(MK_STRUCT(STRUCT_fiemap)))
#endif

     IOCTL(FS_IOC_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(FS_IOC_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(FS_IOC_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(FS_IOC_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(FS_IOC32_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(FS_IOC32_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
     IOCTL(FS_IOC32_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
     IOCTL(FS_IOC32_SETVERSION, IOC_W, MK_PTR(TYPE_INT))

#ifdef BTRFS_IOC_SNAP_CREATE
     IOCTL(BTRFS_IOC_SNAP_CREATE, IOC_W,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
#endif
#ifdef BTRFS_IOC_SCAN_DEV
     IOCTL(BTRFS_IOC_SCAN_DEV, IOC_W,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
#endif
#ifdef BTRFS_IOC_FORGET_DEV
     IOCTL(BTRFS_IOC_FORGET_DEV, IOC_W,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
#endif
#ifdef BTRFS_IOC_ADD_DEV
     IOCTL(BTRFS_IOC_ADD_DEV, IOC_W,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
#endif
#ifdef BTRFS_IOC_RM_DEV
     IOCTL(BTRFS_IOC_RM_DEV, IOC_W,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
#endif
#ifdef BTRFS_IOC_SUBVOL_CREATE
     IOCTL(BTRFS_IOC_SUBVOL_CREATE, IOC_W,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
#endif
#ifdef BTRFS_IOC_SNAP_DESTROY
     IOCTL(BTRFS_IOC_SNAP_DESTROY, IOC_W,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
#endif
#ifdef BTRFS_IOC_INO_LOOKUP
     IOCTL(BTRFS_IOC_INO_LOOKUP, IOC_RW,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_args)))
#endif
#ifdef BTRFS_IOC_DEFAULT_SUBVOL
     IOCTL(BTRFS_IOC_DEFAULT_SUBVOL, IOC_W, MK_PTR(TYPE_ULONGLONG))
#endif
#ifdef BTRFS_IOC_SUBVOL_GETFLAGS
     IOCTL(BTRFS_IOC_SUBVOL_GETFLAGS, IOC_R, MK_PTR(TYPE_ULONGLONG))
#endif
#ifdef BTRFS_IOC_SUBVOL_SETFLAGS
     IOCTL(BTRFS_IOC_SUBVOL_SETFLAGS, IOC_W, MK_PTR(TYPE_ULONGLONG))
#endif
#ifdef BTRFS_IOC_SCRUB
     IOCTL(BTRFS_IOC_SCRUB, IOC_RW,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_scrub_args)))
#endif
#ifdef BTRFS_IOC_SCRUB_CANCEL
     IOCTL(BTRFS_IOC_SCRUB_CANCEL, 0, TYPE_NULL)
#endif
#ifdef BTRFS_IOC_SCRUB_PROGRESS
     IOCTL(BTRFS_IOC_SCRUB_PROGRESS, IOC_RW,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_scrub_args)))
#endif
#ifdef BTRFS_IOC_DEV_INFO
     IOCTL(BTRFS_IOC_DEV_INFO, IOC_RW,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_dev_info_args)))
#endif
#ifdef BTRFS_IOC_INO_PATHS
     IOCTL(BTRFS_IOC_INO_PATHS, IOC_RW,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_path_args)))
#endif
#ifdef BTRFS_IOC_LOGICAL_INO
     IOCTL(BTRFS_IOC_LOGICAL_INO, IOC_RW,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_logical_ino_args)))
#endif
#ifdef BTRFS_IOC_QUOTA_CTL
     IOCTL(BTRFS_IOC_QUOTA_CTL, IOC_RW,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_quota_ctl_args)))
#endif
#ifdef BTRFS_IOC_QGROUP_ASSIGN
     IOCTL(BTRFS_IOC_QGROUP_ASSIGN, IOC_W,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_qgroup_assign_args)))
#endif
#ifdef BTRFS_IOC_QGROUP_CREATE
     IOCTL(BTRFS_IOC_QGROUP_CREATE, IOC_W,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_qgroup_create_args)))
#endif
#ifdef BTRFS_IOC_QGROUP_LIMIT
     IOCTL(BTRFS_IOC_QGROUP_LIMIT, IOC_R,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_qgroup_limit_args)))
#endif
#ifdef BTRFS_IOC_QUOTA_RESCAN
     IOCTL(BTRFS_IOC_QUOTA_RESCAN, IOC_W,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_quota_rescan_args)))
#endif
#ifdef BTRFS_IOC_QUOTA_RESCAN_STATUS
     IOCTL(BTRFS_IOC_QUOTA_RESCAN_STATUS, IOC_R,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_quota_rescan_args)))
#endif
#ifdef BTRFS_IOC_QUOTA_RESCAN_WAIT
     IOCTL(BTRFS_IOC_QUOTA_RESCAN_WAIT, 0, TYPE_NULL)
#endif
#ifdef BTRFS_IOC_GET_DEV_STATS
     IOCTL(BTRFS_IOC_GET_DEV_STATS, IOC_RW,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_get_dev_stats)))
#endif
#ifdef BTRFS_IOC_GET_FEATURES
     IOCTL(BTRFS_IOC_GET_FEATURES, IOC_R,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_feature_flags)))
#endif
#ifdef BTRFS_IOC_SET_FEATURES
     IOCTL(BTRFS_IOC_SET_FEATURES, IOC_W,
           MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_btrfs_ioctl_feature_flags), 2)))
#endif
#ifdef BTRFS_IOC_GET_SUPPORTED_FEATURES
     IOCTL(BTRFS_IOC_GET_SUPPORTED_FEATURES, IOC_R,
           MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_btrfs_ioctl_feature_flags), 3)))
#endif
#ifdef BTRFS_IOC_LOGICAL_INO_V2
     IOCTL(BTRFS_IOC_LOGICAL_INO_V2, IOC_RW,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_logical_ino_args)))
#endif
#ifdef BTRFS_IOC_GET_SUBVOL_INFO
     IOCTL(BTRFS_IOC_GET_SUBVOL_INFO, IOC_R,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_get_subvol_info_args)))
#endif
#ifdef BTRFS_IOC_GET_SUBVOL_ROOTREF
     IOCTL(BTRFS_IOC_GET_SUBVOL_ROOTREF, IOC_RW,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_get_subvol_rootref_args)))
#endif
#ifdef BTRFS_IOC_INO_LOOKUP_USER
     IOCTL(BTRFS_IOC_INO_LOOKUP_USER, IOC_RW,
           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_user_args)))
#endif

#ifdef CONFIG_USBFS
  /* USB ioctls */
  IOCTL(USBDEVFS_CONTROL, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_usbdevfs_ctrltransfer)))
  IOCTL(USBDEVFS_BULK, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_usbdevfs_bulktransfer)))
  IOCTL(USBDEVFS_RESETEP, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(USBDEVFS_SETINTERFACE, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_usbdevfs_setinterface)))
  IOCTL(USBDEVFS_SETCONFIGURATION, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(USBDEVFS_GETDRIVER, IOC_R,
        MK_PTR(MK_STRUCT(STRUCT_usbdevfs_getdriver)))
  IOCTL_SPECIAL(USBDEVFS_SUBMITURB, IOC_W, do_ioctl_usbdevfs_submiturb,
      MK_PTR(MK_STRUCT(STRUCT_usbdevfs_urb)))
  IOCTL_SPECIAL(USBDEVFS_DISCARDURB, IOC_RW, do_ioctl_usbdevfs_discardurb,
      MK_PTR(MK_STRUCT(STRUCT_usbdevfs_urb)))
  IOCTL_SPECIAL(USBDEVFS_REAPURB, IOC_R, do_ioctl_usbdevfs_reapurb,
      MK_PTR(TYPE_PTRVOID))
  IOCTL_SPECIAL(USBDEVFS_REAPURBNDELAY, IOC_R, do_ioctl_usbdevfs_reapurb,
      MK_PTR(TYPE_PTRVOID))
  IOCTL(USBDEVFS_DISCSIGNAL, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_usbdevfs_disconnectsignal)))
  IOCTL(USBDEVFS_CLAIMINTERFACE, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(USBDEVFS_RELEASEINTERFACE, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(USBDEVFS_CONNECTINFO, IOC_R,
        MK_PTR(MK_STRUCT(STRUCT_usbdevfs_connectinfo)))
  IOCTL(USBDEVFS_IOCTL, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_usbdevfs_ioctl)))
  IOCTL(USBDEVFS_HUB_PORTINFO, IOC_R,
        MK_PTR(MK_STRUCT(STRUCT_usbdevfs_hub_portinfo)))
  IOCTL(USBDEVFS_RESET, 0, TYPE_NULL)
  IOCTL(USBDEVFS_CLEAR_HALT, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(USBDEVFS_DISCONNECT, 0, TYPE_NULL)
  IOCTL(USBDEVFS_CONNECT, 0, TYPE_NULL)
  IOCTL(USBDEVFS_CLAIM_PORT, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(USBDEVFS_RELEASE_PORT, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(USBDEVFS_GET_CAPABILITIES, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(USBDEVFS_DISCONNECT_CLAIM, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_usbdevfs_disconnect_claim)))
#ifdef USBDEVFS_DROP_PRIVILEGES
  IOCTL(USBDEVFS_DROP_PRIVILEGES, IOC_W, MK_PTR(TYPE_INT))
#endif
#ifdef USBDEVFS_GET_SPEED
  IOCTL(USBDEVFS_GET_SPEED, 0, TYPE_NULL)
#endif
#endif /* CONFIG_USBFS */

  IOCTL(FIOGETOWN, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(FIOSETOWN, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SIOCATMARK, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SIOCGIFNAME, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
  IOCTL(SIOCGIFFLAGS, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
  IOCTL(SIOCSIFFLAGS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
  IOCTL(SIOCGIFADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCSIFADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCGIFBRDADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCSIFBRDADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCGIFDSTADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCSIFDSTADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCGIFNETMASK, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCSIFNETMASK, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCGIFHWADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCSIFHWADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCGIFTXQLEN, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCSIFTXQLEN, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCETHTOOL, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCGIFMETRIC, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
  IOCTL(SIOCSIFMETRIC, IOC_W, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
  IOCTL(SIOCGIFMTU, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
  IOCTL(SIOCSIFMTU, IOC_W, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
  IOCTL(SIOCGIFMAP, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_ifmap_ifreq)))
  IOCTL(SIOCSIFMAP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_ifmap_ifreq)))
  IOCTL(SIOCGIFSLAVE, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
  IOCTL(SIOCSIFSLAVE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
  IOCTL(SIOCGIFMEM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_ptr_ifreq)))
  IOCTL(SIOCSIFMEM, IOC_W, MK_PTR(MK_STRUCT(STRUCT_ptr_ifreq)))
  IOCTL(SIOCADDMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCDELMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
  IOCTL(SIOCGIFINDEX, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
  IOCTL(SIOCSIFPFLAGS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
  IOCTL(SIOCGIFPFLAGS, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
  IOCTL(SIOCSIFLINK, 0, TYPE_NULL)
  IOCTL_SPECIAL(SIOCGIFCONF, IOC_W | IOC_R, do_ioctl_ifconf,
                MK_PTR(MK_STRUCT(STRUCT_ifconf)))
  IOCTL(SIOCGIFENCAP, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SIOCSIFENCAP, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SIOCDARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
  IOCTL(SIOCSARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
  IOCTL(SIOCGARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
  IOCTL(SIOCDRARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
  IOCTL(SIOCSRARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
  IOCTL(SIOCGRARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
  IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
  IOCTL(SIOCGIWMODE, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
  IOCTL(SIOCGIWESSID, 0)
  IOCTL(SIOCSPGRP, IOC_W, MK_PTR(TYPE_INT)) /* pid_t */
  IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */

  /*
   * We can't use IOCTL_SPECIAL() because it will set
   * host_cmd to XXX_OLD and XXX_NEW and these macros
   * are not defined with kernel prior to 5.2.
   * We must set host_cmd to the same value as in target_cmd
   * otherwise the consistency check in syscall_init()
   * will trigger an error.
   * host_cmd is ignored by the do_ioctl_XXX() helpers.
   * FIXME: create a macro to define this kind of entry
   */
  { TARGET_SIOCGSTAMP_OLD, TARGET_SIOCGSTAMP_OLD,
    "SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP,
    { MK_PTR(MK_STRUCT(STRUCT_timeval)) } },
  { TARGET_SIOCGSTAMPNS_OLD, TARGET_SIOCGSTAMPNS_OLD,
    "SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS,
    { MK_PTR(MK_STRUCT(STRUCT_timespec)) } },
  { TARGET_SIOCGSTAMP_NEW, TARGET_SIOCGSTAMP_NEW,
    "SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP,
    { MK_PTR(MK_STRUCT(STRUCT__kernel_sock_timeval)) } },
  { TARGET_SIOCGSTAMPNS_NEW, TARGET_SIOCGSTAMPNS_NEW,
    "SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS,
    { MK_PTR(MK_STRUCT(STRUCT__kernel_timespec)) } },

  IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(RNDZAPENTCNT, 0, TYPE_NULL)
  IOCTL(RNDCLEARPOOL, 0, TYPE_NULL)
#ifdef RNDRESEEDCRNG
  IOCTL(RNDRESEEDCRNG, 0, TYPE_NULL)
#endif

  IOCTL(CDROMPAUSE, 0, TYPE_NULL)
  IOCTL(CDROMSTART, 0, TYPE_NULL)
  IOCTL(CDROMSTOP, 0, TYPE_NULL)
  IOCTL(CDROMRESUME, 0, TYPE_NULL)
  IOCTL(CDROMEJECT, 0, TYPE_NULL)
  IOCTL(CDROMEJECT_SW, 0, TYPE_INT)
  IOCTL(CDROMCLOSETRAY, 0, TYPE_NULL)
  IOCTL(CDROMRESET, 0, TYPE_NULL)
  IOCTL(CDROMPLAYMSF, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(CDROMPLAYTRKIND, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(CDROMREADTOCHDR, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(CDROMREADTOCENTRY, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(CDROMVOLCTRL, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(CDROMSUBCHNL, IOC_RW, MK_PTR(TYPE_INT))
  /* XXX: incorrect (need specific handling) */
  IOCTL(CDROMREADAUDIO, IOC_W, MK_PTR(MK_STRUCT(STRUCT_cdrom_read_audio)))
  IOCTL(CDROMREADCOOKED, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(CDROMREADRAW, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(CDROMREADMODE1, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(CDROMREADMODE2, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(CDROMREADALL, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(CDROMMULTISESSION, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(CDROM_GET_UPC, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(CDROMVOLREAD, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(CDROMSEEK, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(CDROMPLAYBLK, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(CDROM_MEDIA_CHANGED, 0, TYPE_NULL)
  IOCTL(CDROM_SET_OPTIONS, 0, TYPE_INT)
  IOCTL(CDROM_CLEAR_OPTIONS, 0, TYPE_INT)
  IOCTL(CDROM_SELECT_SPEED, 0, TYPE_INT)
  IOCTL(CDROM_SELECT_DISC, 0, TYPE_INT)
  IOCTL(CDROM_DRIVE_STATUS, 0, TYPE_NULL)
  IOCTL(CDROM_DISC_STATUS, 0, TYPE_NULL)
  IOCTL(CDROM_GET_CAPABILITY, 0, TYPE_NULL)
  IOCTL(CDROMAUDIOBUFSIZ, 0, TYPE_INT)
  /* NSIO */
  IOCTL(NS_GET_USERNS, 0, TYPE_NULL)
  IOCTL(NS_GET_PARENT, 0, TYPE_NULL)
  IOCTL(NS_GET_NSTYPE, 0, TYPE_NULL)
  IOCTL(NS_GET_OWNER_UID, IOC_R, MK_PTR(TYPE_INT))
  /* PERF */
  IOCTL(PERF_EVENT_IOC_RESET, 0, TYPE_INT)
  IOCTL(PERF_EVENT_IOC_ENABLE, 0, TYPE_INT)
  IOCTL(PERF_EVENT_IOC_DISABLE, 0, TYPE_INT)
#if 0
  IOCTL(SNDCTL_COPR_HALT, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_COPR_LOAD, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_COPR_RCODE, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_COPR_RCVMSG, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_COPR_RDATA, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_COPR_RESET, 0, TYPE_NULL)
  IOCTL(SNDCTL_COPR_RUN, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_COPR_SENDMSG, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_COPR_WCODE, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_COPR_WDATA, IOC_W, MK_PTR(TYPE_INT))
#endif
  IOCTL(SNDCTL_DSP_CHANNELS, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_DSP_GETBLKSIZE, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_DSP_GETCAPS, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_DSP_GETFMTS, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_DSP_GETIPTR, IOC_R, MK_PTR(MK_STRUCT(STRUCT_count_info)))
  IOCTL(SNDCTL_DSP_GETOPTR, IOC_R, MK_PTR(MK_STRUCT(STRUCT_count_info)))
  IOCTL(SNDCTL_DSP_GETISPACE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_audio_buf_info)))
  IOCTL(SNDCTL_DSP_GETOSPACE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_audio_buf_info)))
  IOCTL(SNDCTL_DSP_GETTRIGGER, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_DSP_MAPINBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
  IOCTL(SNDCTL_DSP_MAPOUTBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
  IOCTL(SNDCTL_DSP_NONBLOCK, 0, TYPE_NULL)
  IOCTL(SNDCTL_DSP_POST, 0, TYPE_NULL)
  IOCTL(SNDCTL_DSP_RESET, 0, TYPE_NULL)
  IOCTL(SNDCTL_DSP_SETDUPLEX, 0, TYPE_NULL)
  IOCTL(SNDCTL_DSP_SETFMT, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_DSP_SETFRAGMENT, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_DSP_SETSYNCRO, 0, TYPE_NULL)
  IOCTL(SNDCTL_DSP_SETTRIGGER, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_DSP_SPEED, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_DSP_STEREO, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_DSP_SUBDIVIDE, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_DSP_SYNC, 0, TYPE_NULL)
#if 0
  IOCTL(SNDCTL_FM_4OP_ENABLE, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_FM_LOAD_INSTR, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_MIDI_INFO, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_MIDI_MPUCMD, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_MIDI_MPUMODE, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_MIDI_PRETIME, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SEQ_CTRLRATE, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SEQ_GETINCOUNT, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SEQ_GETOUTCOUNT, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SEQ_NRMIDIS, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SEQ_NRSYNTHS, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SEQ_OUTOFBAND, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SEQ_PANIC, 0, TYPE_NULL)
  IOCTL(SNDCTL_SEQ_PERCMODE, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SEQ_RESET, 0, TYPE_NULL)
  IOCTL(SNDCTL_SEQ_RESETSAMPLES, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SEQ_SYNC, 0, TYPE_NULL)
  IOCTL(SNDCTL_SEQ_TESTMIDI, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SEQ_THRESHOLD, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SYNTH_INFO, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_SYNTH_MEMAVL, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_TMR_CONTINUE, 0, TYPE_NULL)
  IOCTL(SNDCTL_TMR_METRONOME, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_TMR_SELECT, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_TMR_SOURCE, IOC_RW, MK_PTR(TYPE_INT))
#if 0
     /* we invalidate these defines because they have a same number as
        termios ioctls */
  IOCTL(SNDCTL_TMR_START, 0, TYPE_NULL)
  IOCTL(SNDCTL_TMR_STOP, 0, TYPE_NULL)
#endif
  IOCTL(SNDCTL_TMR_TEMPO, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SNDCTL_TMR_TIMEBASE, IOC_RW, MK_PTR(TYPE_INT))

  IOCTL(SOUND_PCM_WRITE_FILTER, IOC_W | IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_PCM_READ_RATE, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_PCM_READ_CHANNELS, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_PCM_READ_BITS, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_PCM_READ_FILTER, IOC_R, MK_PTR(TYPE_INT))
#endif
  IOCTL(SOUND_MIXER_INFO, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_ACCESS, 0, TYPE_PTRVOID)
  IOCTL(SOUND_MIXER_PRIVATE1, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_PRIVATE2, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_PRIVATE3, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_PRIVATE4, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_PRIVATE5, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_VOLUME, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_BASS, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_TREBLE, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_SYNTH, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_PCM, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_SPEAKER, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_LINE, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_MIC, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_CD, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_IMIX, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_ALTPCM, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_RECLEV, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_IGAIN, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_OGAIN, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_LINE1, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_LINE2, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_LINE3, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_MUTE, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_ENHANCE, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_LOUD, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_RECSRC, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_DEVMASK, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_RECMASK, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_STEREODEVS, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_READ_CAPS, IOC_R, MK_PTR(TYPE_INT))

  IOCTL(SOUND_MIXER_WRITE_VOLUME, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_BASS, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_TREBLE, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_SYNTH, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_PCM, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_SPEAKER, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_LINE, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_MIC, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_CD, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_IMIX, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_ALTPCM, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_RECLEV, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_IGAIN, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_OGAIN, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_LINE1, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_LINE2, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_LINE3, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_MUTE, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_ENHANCE, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_LOUD, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(SOUND_MIXER_WRITE_RECSRC, IOC_W, MK_PTR(TYPE_INT))

  IOCTL(SNDRV_TIMER_IOCTL_PVERSION, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SNDRV_TIMER_IOCTL_NEXT_DEVICE, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_snd_timer_id)))
  IOCTL(SNDRV_TIMER_IOCTL_GINFO, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_snd_timer_ginfo)))
  IOCTL(SNDRV_TIMER_IOCTL_GPARAMS, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_snd_timer_gparams)))
  IOCTL(SNDRV_TIMER_IOCTL_GSTATUS, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_snd_timer_gstatus)))
  IOCTL(SNDRV_TIMER_IOCTL_SELECT, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_snd_timer_select)))
  IOCTL(SNDRV_TIMER_IOCTL_INFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_snd_timer_info)))
  IOCTL(SNDRV_TIMER_IOCTL_PARAMS, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_snd_timer_params)))
  IOCTL(SNDRV_TIMER_IOCTL_STATUS, IOC_R,
        MK_PTR(MK_STRUCT(STRUCT_snd_timer_status)))
  IOCTL(SNDRV_TIMER_IOCTL_START, 0, TYPE_NULL)
  IOCTL(SNDRV_TIMER_IOCTL_STOP, 0, TYPE_NULL)
  IOCTL(SNDRV_TIMER_IOCTL_CONTINUE, 0, TYPE_NULL)
  IOCTL(SNDRV_TIMER_IOCTL_PAUSE, 0, TYPE_NULL)

  IOCTL(HDIO_GETGEO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hd_geometry)))
  IOCTL(HDIO_GET_UNMASKINTR, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(HDIO_GET_MULTCOUNT, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(HDIO_GET_IDENTITY, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(HDIO_GET_KEEPSETTINGS, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(HDIO_GET_NOWERR, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(HDIO_GET_DMA, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(HDIO_GET_32BIT, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(HDIO_DRIVE_CMD, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(HDIO_SET_UNMASKINTR, 0, TYPE_INT)
  IOCTL(HDIO_SET_MULTCOUNT, 0, TYPE_INT)
  IOCTL(HDIO_SET_KEEPSETTINGS, 0, TYPE_INT)
  IOCTL(HDIO_SET_NOWERR, 0, TYPE_INT)
  IOCTL(HDIO_SET_DMA, 0, TYPE_INT)
  IOCTL(HDIO_SET_32BIT, 0, TYPE_INT)
  IOCTL(HDIO_SET_PIO_MODE, 0, TYPE_INT)

  IOCTL(VFAT_IOCTL_READDIR_BOTH, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
  IOCTL(VFAT_IOCTL_READDIR_SHORT, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))

  IOCTL(LOOP_SET_FD, 0, TYPE_INT)
  IOCTL(LOOP_CLR_FD, 0, TYPE_INT)
  IOCTL(LOOP_SET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
  IOCTL(LOOP_GET_STATUS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
  IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
  IOCTL(LOOP_GET_STATUS64, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
  IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT)

  IOCTL(LOOP_CTL_ADD, 0, TYPE_INT)
  IOCTL(LOOP_CTL_REMOVE, 0, TYPE_INT)
  IOCTL(LOOP_CTL_GET_FREE, 0, TYPE_NULL)

  IOCTL(MTIOCTOP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_mtop)))
  IOCTL(MTIOCGET, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtget)))
  IOCTL(MTIOCPOS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtpos)))

  IOCTL(FBIOGET_FSCREENINFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_fb_fix_screeninfo)))
  IOCTL(FBIOGET_VSCREENINFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_fb_var_screeninfo)))
  IOCTL(FBIOPUT_VSCREENINFO, IOC_W, MK_PTR(MK_STRUCT(STRUCT_fb_var_screeninfo)))
  IOCTL(FBIOGETCMAP,        IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_cmap)))
  IOCTL(FBIOPUTCMAP,        IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_cmap)))
  IOCTL(FBIOPAN_DISPLAY,    IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_var_screeninfo)))
  IOCTL(FBIOGET_CON2FBMAP,  IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_con2fbmap)))
  IOCTL(FBIOPUT_CON2FBMAP,  IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_con2fbmap)))

  IOCTL(VT_OPENQRY, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(VT_GETSTATE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_vt_stat)))
  IOCTL(VT_ACTIVATE, 0, TYPE_INT)
  IOCTL(VT_WAITACTIVE, 0, TYPE_INT)
  IOCTL(VT_LOCKSWITCH, 0, TYPE_INT)
  IOCTL(VT_UNLOCKSWITCH, 0, TYPE_INT)
  IOCTL(VT_GETMODE, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_vt_mode)))
  IOCTL(VT_SETMODE, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_vt_mode)))
  IOCTL(VT_RELDISP, 0, TYPE_INT)
  IOCTL(VT_DISALLOCATE, 0, TYPE_INT)

  IOCTL(DM_VERSION, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_REMOVE_ALL,   IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_LIST_DEVICES, IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_DEV_CREATE,   IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_DEV_REMOVE,   IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_DEV_RENAME,   IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_DEV_SUSPEND,  IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_DEV_STATUS,   IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_DEV_WAIT,     IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_TABLE_LOAD,   IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_TABLE_CLEAR,  IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_TABLE_DEPS,   IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_TABLE_STATUS, IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_LIST_VERSIONS,IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_TARGET_MSG,   IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(DM_DEV_SET_GEOMETRY, IOC_RW, do_ioctl_dm,
                MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
  IOCTL_SPECIAL(SIOCADDRT, IOC_W, do_ioctl_rt,
                MK_PTR(MK_STRUCT(STRUCT_rtentry)))
  IOCTL_SPECIAL(SIOCDELRT, IOC_W, do_ioctl_rt,
                MK_PTR(MK_STRUCT(STRUCT_rtentry)))

#ifdef HAVE_DRM_H

  IOCTL_SPECIAL(DRM_IOCTL_VERSION, IOC_RW, do_ioctl_drm,
                MK_PTR(MK_STRUCT(STRUCT_drm_version)))

  IOCTL_SPECIAL(DRM_IOCTL_I915_GETPARAM, IOC_RW, do_ioctl_drm_i915,
                MK_PTR(MK_STRUCT(STRUCT_drm_i915_getparam)))
  IOCTL(DRM_IOCTL_VERSION, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_version)))
  IOCTL(DRM_IOCTL_GET_UNIQUE, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_unique)))
  IOCTL(DRM_IOCTL_GET_MAGIC, IOC_R,
        MK_PTR(MK_STRUCT(STRUCT_drm_auth)))
  IOCTL(DRM_IOCTL_IRQ_BUSID, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_irq_busid)))
  IOCTL(DRM_IOCTL_GET_MAP, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_map)))
  IOCTL(DRM_IOCTL_GET_CLIENT, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_client)))
  IOCTL(DRM_IOCTL_GET_STATS, IOC_R,
        MK_PTR(MK_STRUCT(STRUCT_drm_stats)))
  IOCTL(DRM_IOCTL_SET_VERSION, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_set_version)))
  IOCTL(DRM_IOCTL_MODESET_CTL, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_modeset_ctl)))
  IOCTL(DRM_IOCTL_GEM_CLOSE, IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_gem_close)))
  IOCTL(DRM_IOCTL_GEM_FLINK, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_gem_flink)))
  IOCTL(DRM_IOCTL_GEM_OPEN, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_gem_open)))
  IOCTL(DRM_IOCTL_GET_CAP, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_get_cap)))
  IOCTL(DRM_IOCTL_SET_CLIENT_CAP, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_set_client_cap)))
  IOCTL(DRM_IOCTL_SET_UNIQUE, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_unique)))
  IOCTL(DRM_IOCTL_AUTH_MAGIC, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_auth)))
  IOCTL(DRM_IOCTL_BLOCK, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_block)))
  IOCTL(DRM_IOCTL_UNBLOCK, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_block)))
  IOCTL(DRM_IOCTL_CONTROL, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_control)))
  IOCTL(DRM_IOCTL_ADD_MAP, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_map)))
  IOCTL(DRM_IOCTL_ADD_BUFS, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_buf_desc)))
  IOCTL(DRM_IOCTL_MARK_BUFS, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_buf_desc)))
  IOCTL(DRM_IOCTL_INFO_BUFS, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_buf_info)))
  IOCTL(DRM_IOCTL_MAP_BUFS, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_buf_map)))
  IOCTL(DRM_IOCTL_FREE_BUFS, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_buf_free)))
  IOCTL(DRM_IOCTL_RM_MAP, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_map)))
  IOCTL(DRM_IOCTL_SET_SAREA_CTX, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_ctx_priv_map)))
  IOCTL(DRM_IOCTL_GET_SAREA_CTX, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_ctx_priv_map)))
  IOCTL(DRM_IOCTL_SET_MASTER, 0, TYPE_NULL)
  IOCTL(DRM_IOCTL_DROP_MASTER, 0, TYPE_NULL)
  IOCTL(DRM_IOCTL_ADD_CTX, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_ctx)))
  IOCTL(DRM_IOCTL_RM_CTX, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_ctx)))
  IOCTL(DRM_IOCTL_MOD_CTX, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_ctx)))
  IOCTL(DRM_IOCTL_GET_CTX, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_ctx)))
  IOCTL(DRM_IOCTL_SWITCH_CTX, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_ctx)))
  IOCTL(DRM_IOCTL_NEW_CTX, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_ctx)))
  IOCTL(DRM_IOCTL_RES_CTX, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_ctx_res)))
  IOCTL(DRM_IOCTL_ADD_DRAW, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_draw)))
  IOCTL(DRM_IOCTL_RM_DRAW, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_draw)))
  IOCTL(DRM_IOCTL_DMA, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_dma)))
  IOCTL(DRM_IOCTL_LOCK, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_lock)))
  IOCTL(DRM_IOCTL_UNLOCK, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_lock)))
  IOCTL(DRM_IOCTL_FINISH, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_lock)))
  IOCTL(DRM_IOCTL_PRIME_HANDLE_TO_FD, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_prime_handle)))
  IOCTL(DRM_IOCTL_PRIME_FD_TO_HANDLE, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_prime_handle)))
  IOCTL(DRM_IOCTL_AGP_ACQUIRE, 0, TYPE_NULL)
  IOCTL(DRM_IOCTL_AGP_RELEASE, 0, TYPE_NULL)
  IOCTL(DRM_IOCTL_AGP_ENABLE, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_agp_mode)))
  IOCTL(DRM_IOCTL_AGP_INFO, IOC_R,
        MK_PTR(MK_STRUCT(STRUCT_drm_agp_info)))
  IOCTL(DRM_IOCTL_AGP_ALLOC, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_agp_buffer)))
  IOCTL(DRM_IOCTL_AGP_FREE, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_agp_buffer)))
  IOCTL(DRM_IOCTL_AGP_BIND, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_agp_binding)))
  IOCTL(DRM_IOCTL_AGP_UNBIND, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_agp_binding)))
  IOCTL(DRM_IOCTL_SG_ALLOC, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_scatter_gather)))
  IOCTL(DRM_IOCTL_SG_FREE, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_scatter_gather)))
  IOCTL(DRM_IOCTL_WAIT_VBLANK, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_wait_vblank_reply)))
  IOCTL(DRM_IOCTL_UPDATE_DRAW, IOC_W,
        MK_PTR(MK_STRUCT(STRUCT_drm_update_draw)))
  IOCTL(DRM_IOCTL_MODE_GETRESOURCES, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_card_res)))
  IOCTL(DRM_IOCTL_MODE_GETCRTC, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_crtc)))
  IOCTL(DRM_IOCTL_MODE_SETCRTC, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_crtc)))
  IOCTL(DRM_IOCTL_MODE_CURSOR, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_cursor)))
  IOCTL(DRM_IOCTL_MODE_GETGAMMA, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_crtc_lut)))
  IOCTL(DRM_IOCTL_MODE_SETGAMMA, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_crtc_lut)))
  IOCTL(DRM_IOCTL_MODE_GETENCODER, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_get_encoder)))
  IOCTL(DRM_IOCTL_MODE_GETCONNECTOR, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_get_connector)))
  IOCTL(DRM_IOCTL_MODE_ATTACHMODE, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_mode_cmd)))
  IOCTL(DRM_IOCTL_MODE_DETACHMODE, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_mode_cmd)))
  IOCTL(DRM_IOCTL_MODE_GETPROPERTY, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_get_property)))
  IOCTL(DRM_IOCTL_MODE_SETPROPERTY, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_connector_set_property)))
  IOCTL(DRM_IOCTL_MODE_GETPROPBLOB, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_get_blob)))
  IOCTL(DRM_IOCTL_MODE_GETFB, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_fb_cmd)))
  IOCTL(DRM_IOCTL_MODE_ADDFB, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_fb_cmd)))
  IOCTL(DRM_IOCTL_MODE_RMFB, IOC_RW, TYPE_INT)
  IOCTL(DRM_IOCTL_MODE_PAGE_FLIP, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_crtc_page_flip)))
  IOCTL(DRM_IOCTL_MODE_DIRTYFB, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_fb_dirty_cmd)))
  IOCTL(DRM_IOCTL_MODE_CREATE_DUMB, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_create_dumb)))
  IOCTL(DRM_IOCTL_MODE_MAP_DUMB, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_map_dumb)))
  IOCTL(DRM_IOCTL_MODE_DESTROY_DUMB, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_destroy_dumb)))
  IOCTL(DRM_IOCTL_MODE_GETPLANERESOURCES, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_get_plane_res)))
  IOCTL(DRM_IOCTL_MODE_GETPLANE, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_get_plane)))
  IOCTL(DRM_IOCTL_MODE_SETPLANE, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_set_plane)))
  IOCTL(DRM_IOCTL_MODE_ADDFB2, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_fb_cmd2)))
  IOCTL(DRM_IOCTL_MODE_OBJ_GETPROPERTIES, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_obj_get_properties)))
  IOCTL(DRM_IOCTL_MODE_OBJ_SETPROPERTY, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_obj_set_property)))
  IOCTL(DRM_IOCTL_MODE_CURSOR2, IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_mode_cursor2)))

  IOCTL(DRM_IOCTL_MODE_ATOMIC, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_drm_mode_atomic)))
  IOCTL(DRM_IOCTL_MODE_CREATEPROPBLOB, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_mode_create_blob)))
  IOCTL(DRM_IOCTL_MODE_DESTROYPROPBLOB, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_mode_destroy_blob)))

  IOCTL(DRM_IOCTL_CRTC_GET_SEQUENCE, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_crtc_get_sequence)))
  IOCTL(DRM_IOCTL_CRTC_QUEUE_SEQUENCE, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_crtc_queue_sequence)))

  IOCTL(DRM_IOCTL_SYNCOBJ_CREATE, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_create)))
  IOCTL(DRM_IOCTL_SYNCOBJ_DESTROY, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_destroy)))
  IOCTL(DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_handle)))
  IOCTL(DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_handle)))
  IOCTL(DRM_IOCTL_SYNCOBJ_WAIT, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_wait)))
  IOCTL(DRM_IOCTL_SYNCOBJ_WAIT_OLD, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_wait_old)))

  IOCTL(DRM_IOCTL_SYNCOBJ_RESET, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_array)))
  IOCTL(DRM_IOCTL_SYNCOBJ_SIGNAL, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_array)))

  IOCTL(DRM_IOCTL_MODE_CREATE_LEASE, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_mode_create_lease)))
  IOCTL(DRM_IOCTL_MODE_LIST_LESSEES, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_mode_list_lessees)))
  IOCTL(DRM_IOCTL_MODE_GET_LEASE, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_mode_get_lease)))
  IOCTL(DRM_IOCTL_MODE_REVOKE_LEASE, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_mode_revoke_lease)))
#ifdef DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT
  IOCTL(DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_timeline_wait)))
  IOCTL(DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT_OLD, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_timeline_wait_old)))
#endif
#ifdef DRM_IOCTL_SYNCOBJ_QUERY
  IOCTL(DRM_IOCTL_SYNCOBJ_QUERY, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_timeline_array)))
#endif
#ifdef DRM_IOCTL_SYNCOBJ_TRANSFER
  IOCTL(DRM_IOCTL_SYNCOBJ_TRANSFER, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_transfer)))
#endif
#ifdef DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL
  IOCTL(DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL, IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_drm_syncobj_timeline_array)))
#endif

  IOCTL(DRM_IOCTL_RADEON_CP_INIT    , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_init)))
  IOCTL(DRM_IOCTL_RADEON_CP_START   , 0, TYPE_NULL)
  IOCTL(DRM_IOCTL_RADEON_CP_STOP    , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_cp_stop)))
  IOCTL(DRM_IOCTL_RADEON_CP_RESET   , 0, TYPE_NULL)
  IOCTL(DRM_IOCTL_RADEON_CP_IDLE    , 0, TYPE_NULL)
  IOCTL(DRM_IOCTL_RADEON_RESET      , 0, TYPE_NULL)
  IOCTL(DRM_IOCTL_RADEON_FULLSCREEN , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_fullscreen)))
  IOCTL(DRM_IOCTL_RADEON_SWAP       , 0, TYPE_NULL)
  IOCTL(DRM_IOCTL_RADEON_CLEAR      , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_clear)))
  IOCTL(DRM_IOCTL_RADEON_VERTEX     , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_vertex)))
  IOCTL(DRM_IOCTL_RADEON_INDICES    , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_indices)))
  IOCTL(DRM_IOCTL_RADEON_STIPPLE    , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_stipple)))
  IOCTL(DRM_IOCTL_RADEON_INDIRECT   , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_indirect)))
  /*
   * IOCTL(DRM_IOCTL_RADEON_TEXTURE    , IOC_RW,
   *    MK_PTR(MK_STRUCT(STRUCT_drm_radeon_texture)))
   * IOCTL(DRM_IOCTL_RADEON_VERTEX2    , IOC_W ,
   *    MK_PTR(MK_STRUCT(STRUCT_drm_radeon_vertex2)))
   * IOCTL(DRM_IOCTL_RADEON_CMDBUF     , IOC_W ,
   *    MK_PTR(MK_STRUCT(STRUCT_drm_radeon_cmd_buffer)))
   */
  IOCTL(DRM_IOCTL_RADEON_GETPARAM   , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_getparam)))
  IOCTL(DRM_IOCTL_RADEON_FLIP       , 0, TYPE_NULL)
  IOCTL(DRM_IOCTL_RADEON_ALLOC      , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_mem_alloc)))
  IOCTL(DRM_IOCTL_RADEON_FREE       , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_mem_free)))
  IOCTL(DRM_IOCTL_RADEON_INIT_HEAP  , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_mem_init_heap)))
  IOCTL(DRM_IOCTL_RADEON_IRQ_EMIT   , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_irq_emit)))
  IOCTL(DRM_IOCTL_RADEON_IRQ_WAIT   , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_irq_wait)))
  IOCTL(DRM_IOCTL_RADEON_CP_RESUME  , 0, TYPE_NULL )
  IOCTL(DRM_IOCTL_RADEON_SETPARAM   , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_setparam)))
  IOCTL(DRM_IOCTL_RADEON_SURF_ALLOC , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_surface_alloc)))
  IOCTL(DRM_IOCTL_RADEON_SURF_FREE  , IOC_W , TYPE_INT)
  /* KMS */
  IOCTL(DRM_IOCTL_RADEON_GEM_INFO       , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_info)))
  IOCTL_SPECIAL(DRM_IOCTL_RADEON_GEM_CREATE, IOC_RW, do_ioctl_drm,
                MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_create)))
  IOCTL(DRM_IOCTL_RADEON_GEM_MMAP       , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_mmap)))
  IOCTL(DRM_IOCTL_RADEON_GEM_PREAD      , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_pread)))
  IOCTL(DRM_IOCTL_RADEON_GEM_PWRITE     , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_pwrite)))
  IOCTL(DRM_IOCTL_RADEON_GEM_SET_DOMAIN , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_set_domain)))
  IOCTL(DRM_IOCTL_RADEON_GEM_WAIT_IDLE  , IOC_W ,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_wait_idle)))
  IOCTL(DRM_IOCTL_RADEON_CS             , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_cs)))
  IOCTL(DRM_IOCTL_RADEON_INFO           , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_info)))
  IOCTL(DRM_IOCTL_RADEON_GEM_SET_TILING , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_set_tiling)))
  IOCTL(DRM_IOCTL_RADEON_GEM_GET_TILING , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_get_tiling)))
  IOCTL(DRM_IOCTL_RADEON_GEM_BUSY       , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_busy)))
  IOCTL(DRM_IOCTL_RADEON_GEM_VA         , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_va)))
  IOCTL(DRM_IOCTL_RADEON_GEM_OP         , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_op)))
  IOCTL(DRM_IOCTL_RADEON_GEM_USERPTR    , IOC_RW,
        MK_PTR(MK_STRUCT(STRUCT_drm_radeon_gem_userptr)))


#endif
  IOCTL(DMA_BUF_IOCTL_SYNC,     IOC_W, TYPE_ULONGLONG)
#ifdef DMA_BUF_SET_NAME
  IOCTL(DMA_BUF_SET_NAME,     IOC_W, TYPE_ULONG)
#endif
#ifdef DMA_BUF_SET_NAME_A
  IOCTL(DMA_BUF_SET_NAME_A,     IOC_W, TYPE_ULONG)
#endif
#ifdef DMA_BUF_SET_NAME_B
  IOCTL(DMA_BUF_SET_NAME_B,     IOC_W, TYPE_ULONGLONG)
#endif
#ifdef DMA_BUF_IOCTL_EXPORT_SYNC_FILE
  IOCTL(DMA_BUF_IOCTL_EXPORT_SYNC_FILE,     IOC_RW, TYPE_ULONGLONG)
#endif
#ifdef DMA_BUF_IOCTL_IMPORT_SYNC_FILE
  IOCTL(DMA_BUF_IOCTL_IMPORT_SYNC_FILE,     IOC_W, TYPE_ULONGLONG)
#endif

#ifdef TARGET_TIOCSTART
  IOCTL_IGNORE(TIOCSTART)
  IOCTL_IGNORE(TIOCSTOP)
#endif

#ifdef HAVE_SYS_KCOV_H
  IOCTL(KCOV_ENABLE, 0, TYPE_NULL)
  IOCTL(KCOV_DISABLE, 0, TYPE_NULL)
  IOCTL(KCOV_INIT_TRACE, IOC_R, TYPE_ULONG)
#endif

  IOCTL(TUNSETDEBUG,     IOC_W, TYPE_INT)
  IOCTL(TUNSETIFF,       IOC_RW, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
  IOCTL(TUNSETPERSIST,   IOC_W, TYPE_INT)
  IOCTL(TUNSETOWNER,     IOC_W, TYPE_INT)
  IOCTL(TUNSETLINK,      IOC_W, TYPE_INT)
  IOCTL(TUNSETGROUP,     IOC_W, TYPE_INT)
  IOCTL(TUNGETFEATURES,  IOC_R, MK_PTR(TYPE_INT))
  IOCTL(TUNSETOFFLOAD,   IOC_W, TYPE_LONG)
  IOCTL_SPECIAL(TUNSETTXFILTER, IOC_W, do_ioctl_TUNSETTXFILTER,
                /*
                 * We can't represent `struct tun_filter` in thunk so leaving
                 * it uninterpreted. do_ioctl_TUNSETTXFILTER will do the
                 * conversion.
                 */
                TYPE_PTRVOID)
  IOCTL(TUNGETIFF,       IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
  IOCTL(TUNGETSNDBUF,    IOC_R, MK_PTR(TYPE_INT))
  IOCTL(TUNSETSNDBUF,    IOC_W, MK_PTR(TYPE_INT))
  /*
   * TUNATTACHFILTER and TUNDETACHFILTER are not supported. Linux kernel keeps a
   * user pointer in TUNATTACHFILTER, which we are not able to correctly handle.
   */
  IOCTL(TUNGETVNETHDRSZ, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(TUNSETVNETHDRSZ, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(TUNSETQUEUE,     IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
  IOCTL(TUNSETIFINDEX ,  IOC_W, MK_PTR(TYPE_INT))
  /* TUNGETFILTER is not supported: see TUNATTACHFILTER. */
#ifdef TUNSETVNETLE
  IOCTL(TUNSETVNETLE,    IOC_W, MK_PTR(TYPE_INT))
  IOCTL(TUNGETVNETLE,    IOC_R, MK_PTR(TYPE_INT))
#endif
#ifdef TUNSETVNETBE
  IOCTL(TUNSETVNETBE,    IOC_W, MK_PTR(TYPE_INT))
  IOCTL(TUNGETVNETBE,    IOC_R, MK_PTR(TYPE_INT))
#endif
#ifdef TUNSETSTEERINGEBPF
  IOCTL(TUNSETSTEERINGEBPF, IOC_W, MK_PTR(TYPE_INT))
#endif
#ifdef TUNSETFILTEREBPF
  IOCTL(TUNSETFILTEREBPF, IOC_W, MK_PTR(TYPE_INT))
#endif
#ifdef TUNSETCARRIER
  IOCTL(TUNSETCARRIER,   IOC_W, MK_PTR(TYPE_INT))
#endif
#ifdef TUNGETDEVNETNS
  IOCTL(TUNGETDEVNETNS,  IOC_R, TYPE_NULL)
#endif

  /* V4l2 ioctls*/
  IOCTL(VIDIOC_QUERYCAP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_v4l2_capability)))
  IOCTL(VIDIOC_ENUM_FMT, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_fmtdesc)))
  IOCTL_SPECIAL(VIDIOC_G_FMT, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_format))) /*4*/
  IOCTL_SPECIAL(VIDIOC_S_FMT, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_format))) /*5*/
  IOCTL(VIDIOC_REQBUFS, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_requestbuffers)))
  IOCTL_SPECIAL(VIDIOC_QUERYBUF, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_buffer)))
  IOCTL_SPECIAL(VIDIOC_G_FBUF, IOC_R, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_framebuffer)))
  IOCTL(VIDIOC_OVERLAY, IOC_W, MK_PTR(TYPE_INT)) /*14*/
  IOCTL_SPECIAL(VIDIOC_QBUF, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_buffer)))
  IOCTL_SPECIAL(VIDIOC_EXPBUF, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_exportbuffer)))
  IOCTL_SPECIAL(VIDIOC_DQBUF, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_buffer))) /*17*/
  IOCTL(VIDIOC_STREAMON, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(VIDIOC_STREAMOFF, IOC_W, MK_PTR(TYPE_INT))
  IOCTL(VIDIOC_G_PARM, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_streamparm))) /*21*/
  IOCTL(VIDIOC_S_PARM, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_streamparm))) /*22*/
  IOCTL(VIDIOC_G_STD, IOC_R, MK_PTR(TYPE_ULONGLONG)) /*23*/
  IOCTL(VIDIOC_S_STD, IOC_W, MK_PTR(TYPE_ULONGLONG)) /*24*/
  IOCTL_SPECIAL(VIDIOC_ENUMSTD, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_standard)))
  IOCTL_SPECIAL(VIDIOC_ENUMINPUT, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_input)))
  IOCTL(VIDIOC_G_CTRL, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_control))) /* 27 */
  IOCTL(VIDIOC_S_CTRL, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_control))) /* 28 */
  IOCTL(VIDIOC_G_TUNER, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_tuner)))
  IOCTL(VIDIOC_G_AUDIO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_v4l2_audio))) /*33*/
  IOCTL(VIDIOC_S_AUDIO, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_audio)))
  IOCTL(VIDIOC_QUERYCTRL, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_queryctrl)))
  IOCTL(VIDIOC_QUERYMENU, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_querymenu)))
  IOCTL(VIDIOC_G_INPUT, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(VIDIOC_S_INPUT, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL_SPECIAL(VIDIOC_G_EDID, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_edid)))
  IOCTL_SPECIAL(VIDIOC_S_EDID, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_edid)))
  IOCTL(VIDIOC_G_OUTPUT, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(VIDIOC_S_OUTPUT, IOC_RW, MK_PTR(TYPE_INT))
  IOCTL(VIDIOC_ENUMOUTPUT, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_output)))
  IOCTL(VIDIOC_G_AUDOUT, IOC_R, MK_PTR(MK_STRUCT(STRUCT_v4l2_audioout))) /*49*/
  IOCTL(VIDIOC_S_AUDOUT, IOC_W, MK_PTR(MK_STRUCT(STRUCT_v4l2_audioout))) /*50*/
  IOCTL(VIDIOC_G_MODULATOR, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_modulator)))
  IOCTL(VIDIOC_S_MODULATOR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_v4l2_modulator)))
  IOCTL(VIDIOC_G_FREQUENCY, IOC_R, MK_PTR(MK_STRUCT(STRUCT_v4l2_frequency)))
  IOCTL(VIDIOC_S_FREQUENCY, IOC_W, MK_PTR(MK_STRUCT(STRUCT_v4l2_frequency)))
  IOCTL(VIDIOC_CROPCAP, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_cropcap)))
  IOCTL(VIDIOC_G_CROP, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_crop)))
  IOCTL(VIDIOC_S_CROP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_v4l2_crop)))
  IOCTL(VIDIOC_G_JPEGCOMP, IOC_R,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_jpegcompression)))
  IOCTL(VIDIOC_S_JPEGCOMP, IOC_W,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_jpegcompression)))
  IOCTL(VIDIOC_QUERYSTD, IOC_R, MK_PTR(TYPE_ULONGLONG))
  IOCTL_SPECIAL(VIDIOC_TRY_FMT, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_format))) /*64*/
  IOCTL(VIDIOC_ENUMAUDIO, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_audio)))
  IOCTL(VIDIOC_ENUMAUDOUT, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_audioout)))
  IOCTL(VIDIOC_G_PRIORITY, IOC_RW, MK_PTR(TYPE_INT)) /* 67 */
  IOCTL(VIDIOC_S_PRIORITY, IOC_W, MK_PTR(TYPE_INT)) /* 68 */
  IOCTL(VIDIOC_G_SLICED_VBI_CAP, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_sliced_vbi_cap)))
  IOCTL(VIDIOC_LOG_STATUS, 0)
  IOCTL_SPECIAL(VIDIOC_TRY_EXT_CTRLS, IOC_RW, do_ioctl_v4l2,
                MK_PTR(MK_STRUCT(STRUCT_v4l2_ext_controls)))
  IOCTL_SPECIAL(VIDIOC_G_EXT_CTRLS, IOC_RW, do_ioctl_v4l2,
                MK_PTR(MK_STRUCT(STRUCT_v4l2_ext_controls)))
  IOCTL_SPECIAL(VIDIOC_S_EXT_CTRLS, IOC_RW, do_ioctl_v4l2,
                MK_PTR(MK_STRUCT(STRUCT_v4l2_ext_controls)))
  IOCTL(VIDIOC_ENUM_FRAMESIZES, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_frmsizeenum)))/*74*/
  IOCTL(VIDIOC_ENUM_FRAMEINTERVALS, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_frmivalenum))) /*75*/
  IOCTL(VIDIOC_G_ENC_INDEX, IOC_R, MK_PTR(MK_STRUCT(STRUCT_v4l2_enc_idx)))
  IOCTL(VIDIOC_ENCODER_CMD, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_encoder_cmd)))
  IOCTL(VIDIOC_TRY_ENCODER_CMD, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_encoder_cmd)))
  IOCTL(VIDIOC_DBG_S_REGISTER, IOC_W,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_dbg_register)))
  IOCTL(VIDIOC_DBG_G_REGISTER, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_dbg_register)))
  IOCTL(VIDIOC_S_HW_FREQ_SEEK, IOC_W,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_hw_freq_seek)))
  IOCTL(VIDIOC_S_DV_TIMINGS, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_dv_timings)))
  IOCTL(VIDIOC_G_DV_TIMINGS, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_dv_timings)))
  IOCTL_SPECIAL(VIDIOC_DQEVENT, IOC_R, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_event))) /*89*/
  IOCTL(VIDIOC_SUBSCRIBE_EVENT, IOC_W,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_event_subscription)))
  IOCTL(VIDIOC_UNSUBSCRIBE_EVENT, IOC_W,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_event_subscription)))
  IOCTL_SPECIAL(VIDIOC_CREATE_BUFS, IOC_RW, do_ioctl_v4l2,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_create_buffers)))
  IOCTL(VIDIOC_G_SELECTION, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_selection))) /*94*/
  IOCTL(VIDIOC_S_SELECTION, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_selection))) /*95*/
  IOCTL(VIDIOC_DECODER_CMD, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_v4l2_decoder_cmd)))
  IOCTL(VIDIOC_TRY_DECODER_CMD, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_decoder_cmd)))
  IOCTL(VIDIOC_ENUM_DV_TIMINGS, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_enum_dv_timings)))
  IOCTL(VIDIOC_QUERY_DV_TIMINGS, IOC_R,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_dv_timings))) /*87*/
  IOCTL(VIDIOC_DV_TIMINGS_CAP, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_dv_timings_cap)))
  IOCTL(VIDIOC_QUERY_EXT_CTRL, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_v4l2_query_ext_ctrl)))

/* Audio */
  IOCTL(SNDRV_SEQ_IOCTL_PVERSION, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SNDRV_SEQ_IOCTL_CLIENT_ID, IOC_R, MK_PTR(TYPE_INT))
  IOCTL(SNDRV_SEQ_IOCTL_RUNNING_MODE, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_snd_seq_running_info)))
  IOCTL(SNDRV_SEQ_IOCTL_GET_CLIENT_INFO, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_snd_seq_client_info))) /* 0x10 */
  IOCTL(SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, IOC_W,
                           MK_PTR(MK_STRUCT(STRUCT_snd_seq_client_info))) /* 0x11 */

  IOCTL_SPECIAL(SNDRV_SEQ_IOCTL_CREATE_PORT, IOC_RW, do_ioctl_seq,
                           MK_PTR(MK_STRUCT(STRUCT_snd_seq_port_info)))

  IOCTL_SPECIAL(SNDRV_SEQ_IOCTL_DELETE_PORT, IOC_W, do_ioctl_seq,
                           MK_PTR(MK_STRUCT(STRUCT_snd_seq_port_info)))

  IOCTL(SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, IOC_W,
                           MK_PTR(MK_STRUCT(STRUCT_snd_seq_port_subscribe))) /* 0x30 */

  IOCTL(SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT, IOC_W,
                           MK_PTR(MK_STRUCT(STRUCT_snd_seq_port_subscribe))) /* 0x30 */

  IOCTL(SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_snd_seq_client_info)))
  IOCTL_SPECIAL(SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT, IOC_RW, do_ioctl_seq,
                           MK_PTR(MK_STRUCT(STRUCT_snd_seq_port_info)))

  IOCTL(SNDRV_CTL_IOCTL_PVERSION, IOC_R, TYPE_INT)
  IOCTL(SNDRV_CTL_IOCTL_CARD_INFO, IOC_R,
                           MK_PTR(MK_STRUCT(STRUCT_snd_ctl_card_info)))
  IOCTL(SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE, IOC_R, TYPE_INT)
  IOCTL(SNDRV_CTL_IOCTL_PCM_INFO, IOC_RW,
                           MK_PTR(MK_STRUCT(STRUCT_snd_pcm_info)))
  IOCTL(SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE, IOC_W, TYPE_INT)

  IOCTL(SNDRV_PCM_IOCTL_PVERSION , IOC_R, TYPE_INT)
  IOCTL(SNDRV_PCM_IOCTL_INFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_snd_pcm_info)))
  IOCTL(SNDRV_PCM_IOCTL_TSTAMP , IOC_W, TYPE_INT)
  IOCTL(SNDRV_PCM_IOCTL_TTSTAMP , IOC_W, TYPE_INT)
  IOCTL_SPECIAL(SNDRV_PCM_IOCTL_HW_REFINE, IOC_RW, do_ioctl_seq,
                           MK_PTR(MK_STRUCT(STRUCT_snd_pcm_hw_params)))
  IOCTL_SPECIAL(SNDRV_PCM_IOCTL_HW_PARAMS, IOC_RW, do_ioctl_seq,
                           MK_PTR(MK_STRUCT(STRUCT_snd_pcm_hw_params)))
  IOCTL(SNDRV_PCM_IOCTL_HW_FREE, 0)
  IOCTL_SPECIAL(SNDRV_PCM_IOCTL_SW_PARAMS, IOC_RW, do_ioctl_seq,
                           MK_PTR(MK_STRUCT(STRUCT_snd_pcm_sw_params)))
  IOCTL(SNDRV_PCM_IOCTL_USER_PVERSION , IOC_W, TYPE_INT)
  IOCTL_SPECIAL(SNDRV_PCM_IOCTL_SYNC_PTR, IOC_RW, do_ioctl_seq,
                           MK_PTR(MK_STRUCT(STRUCT_snd_pcm_sync_ptr)))
  IOCTL_SPECIAL(SNDRV_PCM_IOCTL_CHANNEL_INFO, IOC_R, do_ioctl_seq,
                           MK_PTR(MK_STRUCT(STRUCT_snd_pcm_channel_info)))
  IOCTL(SNDRV_PCM_IOCTL_PREPARE, 0)
  IOCTL(SNDRV_PCM_IOCTL_RESET, 0)
  IOCTL(SNDRV_PCM_IOCTL_START, 0)
  IOCTL(SNDRV_PCM_IOCTL_DROP, 0)
  IOCTL(SNDRV_PCM_IOCTL_REWIND, IOC_W, TYPE_LONG)
  IOCTL(SNDRV_PCM_IOCTL_XRUN, 0)
  IOCTL_SPECIAL(SNDRV_PCM_IOCTL_WRITEI_FRAMES, IOC_R, do_ioctl_seq,
                           MK_PTR(MK_STRUCT(STRUCT_snd_xferi)))
  IOCTL_SPECIAL(SNDRV_PCM_IOCTL_READI_FRAMES, IOC_R, do_ioctl_seq,
                           MK_PTR(MK_STRUCT(STRUCT_snd_xferi)))

  IOCTL_SPECIAL(MPT3IOCINFO, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_ioctl_iocinfo)))
  IOCTL_SPECIAL(MPT3COMMAND, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_ioctl_command)))
  IOCTL_SPECIAL(MPT3EVENTQUERY, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_ioctl_eventquery)))
  IOCTL_SPECIAL(MPT3EVENTENABLE, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_ioctl_eventenable)))
  IOCTL_SPECIAL(MPT3EVENTREPORT, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_ioctl_eventreport)))
  IOCTL_SPECIAL(MPT3HARDRESET, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_ioctl_diag_reset)))
  IOCTL_SPECIAL(MPT3BTDHMAPPING, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_ioctl_btdh_mapping)))
  IOCTL_SPECIAL(MPT3DIAGREGISTER, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_diag_register)))
  IOCTL_SPECIAL(MPT3DIAGRELEASE, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_diag_release)))
  IOCTL_SPECIAL(MPT3DIAGUNREGISTER, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_diag_unregister)))
  IOCTL_SPECIAL(MPT3DIAGQUERY, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_diag_query)))
  IOCTL_SPECIAL(MPT3DIAGREADBUFFER, IOC_RW, do_ioctl_mpt3,
                MK_PTR(MK_STRUCT(STRUCT_mpt3_diag_read_buffer)))

#include "ioctl/ioctls/ioctl_amdgpu_drm.h"

  IOCTL(MEGASAS_IOC_FIRMWARE32,     0, TYPE_INT)
  IOCTL(MEGASAS_IOC_FIRMWARE,       0, TYPE_INT)
  IOCTL(LINUX_SG_GET_VERSION_NUM,   0, TYPE_INT)
  IOCTL(LINUX_SG_IO,     IOC_RW, MK_PTR(MK_STRUCT(
      STRUCT_sg_io_hdr)))

  IOCTL(UI_SET_EVBIT, IOC_W, TYPE_INT)
  IOCTL(UI_SET_KEYBIT, IOC_W, TYPE_INT)
  IOCTL(UI_SET_RELBIT, IOC_W, TYPE_INT)
  IOCTL(UI_DEV_CREATE, 0)
  IOCTL(UI_DEV_DESTROY, 0)

  IOCTL(HIDIOCGRDESCSIZE, IOC_R, TYPE_INT)
  IOCTL(HIDIOCGRDESC, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hidraw_report_descriptor)))
  IOCTL(HIDIOCGRAWINFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hidraw_devinfo)))
